//package com.navi.loaddata.loadService.impl.measureData.cf;
//
//import com.navi.loaddata.core.gpEntity.*;
//import com.navi.loaddata.core.gpEntity.cf.WppFdefectF;
//import com.navi.loaddata.core.gpEntity.cf.WppFdefectGlassF;
//import com.navi.loaddata.core.gpEntity.cf.WppFdefectPanelF;
//import com.navi.loaddata.core.mysqlEntity.EtlConfD;
//import com.navi.loaddata.core.repository.impl.GreenPlumRepositoryImpl;
//import com.navi.loaddata.core.util.ProcessUtil;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.util.StringUtils;
//
//import java.sql.Timestamp;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//@Service
//@Transactional(transactionManager = "secondaryPlatformTransactionManager")
//public class LoadDefectInfoServiceCF {
//
//    @Autowired
//    private GreenPlumRepositoryImpl dao2;
//
//
//    public List<WppFdefectGlassF> loadGlassInfo(EtlConfD etlConfD) {
//        StringBuffer hql = new StringBuffer();
//        hql.append("FROM WppFdefectGlassF WHERE evtTimestamp < '").append(etlConfD.getEtlTimestamp())
//                .append("' and dbTimestamp >= '")
//                .append(etlConfD.getRunStartTimestamp())
//                .append("' and dbTimestamp<'")
//                .append(etlConfD.getRunEndTimestamp())
//                .append("' and realFlg='Y' and glassId like 'C%'");
//        hql.append(ProcessUtil.getOpeHql(etlConfD.getOpe()));
//        // todo  EQPT
//        hql.append(" order by evtTimestamp ");
//
//        return dao2.list(WppFdefectGlassF.class, hql.toString());
//    }
//
//    public List<WppFdefectPanelF> loadPanelInfo(EtlConfD etlConfD, WppFdefectGlassF glass) {
//
//        StringBuffer hql = new StringBuffer();
//        hql.append("FROM WppFdefectPanelF WHERE evtTimestamp = '")
//                .append(glass.getEvtTimestamp())
//                .append("' and realFlg='Y' ")
//                .append(" and glassId = '").append(glass.getGlassId()).append("' ")
//                .append(" and jgeCnt = '").append(glass.getJgeCnt()).append("' ");
//        hql.append(ProcessUtil.getOpeHql(etlConfD.getOpe()));
//        return dao2.list(WppFdefectPanelF.class, hql.toString());
//    }
//
//    public List<WppFdefectF> loadDefectInfo(EtlConfD etlConfD, WppFdefectGlassF glass) {
//
//        StringBuffer hql = new StringBuffer();
//        hql.append("FROM WppFdefectF WHERE evtTimestamp = '")
//                .append(glass.getEvtTimestamp())
//                .append("' and realFlg='Y' ")
//                .append(" and glassId = '").append(glass.getGlassId()).append("' ")
//                .append(" and jgeCnt = '").append(glass.getJgeCnt()).append("' ");
//        hql.append(ProcessUtil.getOpeHql(etlConfD.getOpe()));
//        return dao2.list(WppFdefectF.class, hql.toString());
//    }
//
//
//    public Map<String,String> loadMOpeDInfo(EtlConfD etlConfD) {
//        Map<String,String> mapOpe=new HashMap<>();
//        List<MOpeD> opeList=new ArrayList<>();
//        StringBuffer hql = new StringBuffer();
//        hql.append("FROM MOpeD WHERE 1=1 ");
//        hql.append(ProcessUtil.getOpeHql(etlConfD.getOpe()));
//        hql.append(" order by evtTimestamp");
//        opeList=dao2.list(MOpeD.class, hql.toString());
//
//        opeList.forEach(opeFormat -> {
//            if(!StringUtils.isEmpty(opeFormat.getOpeDefFormat())){
//                mapOpe.put(opeFormat.getOpeId(), opeFormat.getOpeDefFormat());
//            }else{
//                mapOpe.put(opeFormat.getOpeId(), null);
//            }
//        });
//        return mapOpe;
//    }
//
//    public List<MppLayoutPnlD> big2small(WppFdefectGlassF glass) throws Exception {
//        String layoutId;
//        List<MProdD> mProdD=dao2.find(MProdD.class, "FROM MProdD where shopId='CF' and  prodId='" + glass.getProdId() + "'");
//        if(mProdD.size()==0||StringUtils.isEmpty(mProdD.get(0).getLayoutId())){
//            return null;
//        }
//        layoutId = mProdD.get(0).getLayoutId();
//        List<MppLayoutPnlD> layoutPnlDS = dao2.list(MppLayoutPnlD.class, "FROM MppLayoutPnlD WHERE layoutId = '" + layoutId + "'");
//        return layoutPnlDS;
//
//    }
//
//}
